package es.cea.listener;

import java.awt.List;
import java.util.ArrayList;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

/**
 * Application Lifecycle Listener implementation class MiListener
 *
 */
@WebListener
public class MiListener implements ServletContextListener {

    /**
     * Default constructor. 
     */
    public MiListener() {
        // TODO Auto-generated constructor stub
    }

	/**
     * @see ServletContextListener#contextInitialized(ServletContextEvent)
     */
    public void contextInitialized(ServletContextEvent arg0) {
       
    	
    		ServletContext servletContext = arg0.getServletContext();
    		
    		Object source = arg0.getSource();
    		ArrayList listaLibros = new ArrayList();
    		
    		listaLibros.add("libro1");
    		listaLibros.add("libro2");
    		listaLibros.add("libro3");
    		servletContext.setAttribute("libreria",listaLibros);
    		
    		 
    	
    }

	/**
     * @see ServletContextListener#contextDestroyed(ServletContextEvent)
     */
    public void contextDestroyed(ServletContextEvent arg0) {
        // TODO Auto-generated method stub
    }
	
}
